As should be appreciated, a virtual machine is a software application operating on a computing device for the purpose of emulating a hardware system. Typically, although not necessarily, the virtual machine is employed on the computing device to host a user application or the like while at the same time isolating such user application from such computing device or from other applications on such computing device. It may be the case that a different variation of a virtual machine is written for each of a plurality of different computing devices so that any user application written for the virtual machine can be operated on any of the different computing devices. Thus, a different variation of the user application for each different computing device is not needed.
Among other things, a virtual machine may require access to a storage device to store and retrieve data, and generally for any purpose that a storage device would be employed. Accordingly, the virtual machine may in fact be provided with such a storage device. Notably, inasmuch as the virtual machine is in fact a software construct, so too may the provided storage device employed thereby be a part of the software construct that is the virtual machine or else another software construct. In either case, the storage device is in effect a virtual storage device.
New architectures for computing devices and new software now allow a single computing device to run a plurality of partitions, each of which can be employed to instantiate a virtual machine to in turn host an instance of an operating system. In such a computing device, a storage hardware device of the computing device such as a RAM memory or a hard disk drive memory may be dynamically assigned to a particular partition so that the particular partition can directly control such storage hardware device. Such particular partition, then, is in effect a host that provides storage capabilities as a ‘storage host partition’ (‘SHP’). Similarly, such SHP provides storage services to another partition which is in effect a client that consumes such capabilities as a ‘storage client partition’ (‘SCP’). Thus, the SCP and the SHP communicate to accomplish storage-related operations.
Typically, a virtual storage device of an SCP is provided by the SHP in the form of an actual storage image file maintained by the SHP in an actual storage hardware device. Thus, and as may be appreciated, changes made to the virtual storage device by the SCP are persisted by the SHP in the corresponding storage image file on the storage hardware device. Put another way, the actual storage image file is a representation of the virtual storage device of a virtual machine such as an SCP. Accordingly, whenever the virtual operating system of the SCP executes a read or write operation with regard to the virtual storage device thereof, the operation data is read from or written to the storage image file by the SHP.
Inasmuch as the virtual storage device of an SCP might be expected to have a relatively large storage capacity, perhaps on the order of 1-16 gigabytes or more, it follows that, absent other considerations, the corresponding storage image file as maintained by the SHP can also have the same relatively large storage capacity. However, and as should be appreciated, the storage capacity of the virtual storage device likely is not fully occupied by data, and instead may contain significant if not large amounts of empty space or space with null data therein. As should be appreciated, then, such null data in the virtual storage device need not be represented within the corresponding storage image file, at least on a byte-for-byte basis. By not storing null data from the virtual storage device in the corresponding storage image file, then, such storage image file may be stored on the storage hardware device as a smaller if not much smaller file.
Accordingly, a need exists for a method and mechanism by which the storage image file corresponding to a virtual storage device may be stored on a storage hardware device in a relatively compact form whereby null data from the virtual storage device is only minimally represented within the storage image file. In particular, a need exists for such a method and mechanism whereby maintenance may be performed on the storage image file, for example to compact same or to de-fragment same. In addition, a need exists for such a method and mechanism that can perform such maintenance while the virtual storage device is being employed by a virtual machine or the like, such that the virtual machine need not be halted to perform the maintenance.